package main

import "fmt"

type Point struct {
	x int
	y int
}
type Point2 struct {
	x int
	y int
	z int
}

func main() {
	var a interface{}
	var p1 = Point{1, 2}
	fmt.Println("p1 =", p1)
	fmt.Printf("p1 的地址是%p\n", &p1)
	a = p1
	fmt.Println("a =", a)
	fmt.Printf("a 的地址是%p\n", &a)
	var p2 Point
	// p2 = a 不可以，报错
	p2 = a.(Point)
	fmt.Println("p2 =", p2)
	fmt.Printf("p2 的地址是%p\n", &p2)
	p3, success := a.(Point2)
	if success {
		fmt.Println("p3 =", p3)
		fmt.Printf("p3 的地址是%p\n", &p3)
	} else {
		fmt.Println("a ==> p3 failed")
	}

}
